//
//  NewsTableViewCell.m
//  WangYi
//
//  Created by dllo on 15/11/12.
//  Copyright © 2015年 0. All rights reserved.
//

#import "NewsTableViewCell.h"
#import "DaoHangModel.h"
@implementation NewsTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubViews];
    }
    
    return self;
}

-(void)creatSubViews{

    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH*5, HEIGHT*10, WIDTH*130,HEIGHT* 150)];
    self.headImageView.layer.masksToBounds =YES;
    self.headImageView.layer.cornerRadius = HEIGHT*10;
    self.headImageView.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.headImageView];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH*140, HEIGHT*10, WIDTH*375 - WIDTH*140, HEIGHT*50)];
    self.titleLabel.font = [UIFont systemFontOfSize:HEIGHT*20];
//    self.titleLabel.backgroundColor = [UIColor grayColor];
    self.titleLabel.numberOfLines = 0;
    [self.contentView addSubview:self.titleLabel];
    
    self.detailLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH*140,HEIGHT* 60, WIDTH*375 - WIDTH*145, HEIGHT*60)];
    self.detailLabel.font = [UIFont systemFontOfSize:WIDTH*18];
    self.detailLabel.numberOfLines = 0;
//    self.detailLabel.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.detailLabel];
    
    self.numberLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH*375-WIDTH*80, HEIGHT*125, WIDTH*80, HEIGHT*20)];
    self.numberLabel.font = [UIFont systemFontOfSize:WIDTH*17];
    self.numberLabel.numberOfLines = 0;
//    self.numberLabel.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.numberLabel];
    
}

-(void)setModel:(DaoHangModel *)model{

    _model = model;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.imgsrc] placeholderImage:[UIImage imageNamed:@"zhanwei.png"]];
    self.titleLabel.text = model.title;
    self.detailLabel.text = model.digest;
    self.numberLabel.text = [NSString stringWithFormat:@"%ld贴",model.replyCount];
    
}

@end
